pp108 : ondblclick Property

ondblclick Property

This is an optional property that contains the pointer to a function to be to be called when an item in the tree is double clicked.

Syntax

xml

<TreeItem>
<description>sDesc</description>
<ondblclick>fpFunction</ ondblclick >
 .. .. ..
</TreeItem>

Parameters

fpFunction

Pointer to a function that is to be called.

eventObject

Refers to the eventObject for this event. It is the last parameter passed for the ondblclick property.

Remarks

The parameter passed to the ondblclick function will contain the item that is selected.

Example

The following example shows how the above method is used.

<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd" >
<html>
<head>
    <title>ondblclick example</title>
    <script src="/cordys/wcp/application.js"></script>
</head>
<script type="cordys/xml" id="menuData" >
    <menu>
         <Continent>
              <caption>Asia</caption>
              <Country>
                    <caption>India</caption>
                    <description>India is my Country</description>
              </Country>
              <Country>
                    <caption>Japan</caption>
                    <description>Japan popular for electronic trends</description>
              </Country>
        </Continent>
        <Continent>
              <caption>Europe</caption>
              <description>Europe</description>
              <Country>
                     <caption>The NetherLands</caption>
                     <description>The NetherLands</description>
               </Country>
               <Country>
                     <caption>UK</caption>
                     <description>UK</description>
               </Country>
        </Continent>
    </menu>
</script>
<script type="cordys/xml" xmlns="" id="MenuTreeSchema" >
    <TreeSchema>
          <searchPath>//menu/</searchPath>
          <Root>
                <description>Continents</description>
          </Root>
          <TreeItem id="ContinentID">
                <searchPath>Continent</searchPath>
                <description>caption</description>
                <ondblclick>handleDblclick</ondblclick>
          </TreeItem>
          <TreeItem id="CountryID">
                <searchPath>Country</searchPath>
                <description>caption</description>
                 <ondblclick>handleDblclick</ondblclick>
          </TreeItem>
    </TreeSchema>
</script>
<script type="text/javascript">
function handleDblclick(treeItem)
{
    var label = cordys.getTextContent(treeItem.getLabel());
    application.notify( label + " is double clicked \n" + cordys.getXML(treeItem.data));
}
</script>
<body>
      <p>Example of the ondblclick property.</p>
	  <div cordysType="wcp.library.ui.Tree" id="myTree" treeData='menuData' treeSchema='MenuTreeSchema'> </div>

</body>
</html>

See Also

tree